<!DOCTYPE html>
<html lang="zh-cmn-Hans">
	
	<head>
		<meta http-equiv="Expires" content="0" />
		<meta http-equiv="Pragma" content="no-cache" />
		<meta http-equiv="Cache-control" content="no-cache" />
		<meta http-equiv="Cache" content="no-cache" />
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
		<title>正则测试</title>
	</head>
	
	<body>
		<p id='xx'></p>
		<script>
			var str = "TAAK17B2681 T2860811K-Q48A1A 10 001";
			//var str = "TAAK17B2681 A3245828811K-NA1A 10 001";
			var pattlh = /T[A-Z\d]{8}(?:\-[A-Z\d]*?)?(?= \d+ \d{3})|A[A-Z\d]{11}(?:\-[A-Z\d]*?)?(?= \d+ \d{3})/; //测试产品型号
			
			console.log(pattlh.exec(str)[0]);
		</script>
	</body>
	
</html>
